@echo off
cls
title Listening Boot
:choose
	echo ******************************************************
	echo *         Listening Boot (v3.0.0-SNAPSHOT)           *    
	echo ******************************************************
	echo *  datetime : %date% %time%            *
	echo *  options  :                                        *
	echo *           1  - clean                               *
	echo *           2  - install                             *
	echo *           3  - deploy                              *
	echo *           4  - clean install                       *
	echo *           5  - clean deploy                        *
	echo ******************************************************
	echo workspace: %~dp0
	echo.
	set "mvn_command="
	
	set/p command=Command:
	
	if "%command%" == "1" (
		set "mvn_command=clean"
		goto execute
	) else (
		goto install
	)

:install
	if "%command%" == "2" (
		set "mvn_command=install"
		goto execute
	) else (
		goto deploy
	)

:deploy
	if "%command%" == "3" (
	set "mvn_command=deploy"
		goto execute
	) else (
		goto cleaninstall
	)

:cleaninstall
	if "%command%" == "4" (
	set "mvn_command=clean install"
		goto execute
	) else (
		goto cleandeploy
	)

:cleandeploy
	if "%command%" == "5" (
	set "mvn_command=clean deploy"
		goto execute
	) else (
		goto error
	)

:error
	echo not supported option
	goto choose

:execute
	if "%mvn_command%"=="" goto choose

	goto execute_dependencies_ensure

	:execute_dependencies_ensure
		echo= 
		echo= 
		set/p execute_dependencies=execute options on listening-boot-dependencies ?[Y/n]:
		if "%execute_dependencies%" == "N" (
			goto execute_parent_ensure
		) else (
			if "%execute_dependencies%" == "n" (
				goto execute_parent_ensure
			) else (
				goto execute_dependencies
			)
		)
	:execute_dependencies
		echo[INFO] ************************************************************************
		echo[INFO] listening-boot-dependencies (v3.0.0-SNAPSHOT)
		echo[INFO] ************************************************************************
		cd %~dp0/listening-boot-dependencies
		echo %~dp0/listening-boot-dependencies
		call mvn %mvn_command%
		goto execute_parent_ensure

	:execute_parent_ensure
		echo= 
		echo= 
		set/p execute_parent=execute options on listening-boot-parent ?[Y/n]:
		if "%execute_parent%" == "N" (
			goto execute_tools_ensure
		) else (
			if "%execute_parent%" == "n" (
				goto execute_tools_ensure
			) else (
				goto execute_parent
			)
		)
	:execute_parent
		echo[INFO] ************************************************************************
		echo[INFO] listening-boot-parent (v3.0.0-SNAPSHOT)
		echo[INFO] ************************************************************************
		cd %~dp0/listening-boot-parent
		echo %~dp0/listening-boot-parent
		call mvn %mvn_command%
		goto execute_tools_ensure

	:execute_tools_ensure
		echo= 
		echo= 
		set/p execute_tools=execute options on listening-boot-tools ?[Y/n]:
		if "%execute_tools%" == "N" (
			goto execute_autoconfigure_ensure
		) else (
			if "%execute_tools%" == "n" (
				goto execute_autoconfigure_ensure
			) else (
				goto execute_tools
			)
		)
	:execute_tools
		echo[INFO] ************************************************************************
		echo[INFO] listening-boot-tools (v3.0.0-SNAPSHOT)
		echo[INFO] ************************************************************************
		cd %~dp0/listening-boot-tools
		echo %~dp0/listening-boot-tools
		call mvn %mvn_command%
		goto execute_autoconfigure_ensure
		
	:execute_autoconfigure_ensure
		echo= 
		echo= 
		set/p execute_autoconfigure=execute options on listening-boot-autoconfigure ?[Y/n]:
		if "%execute_autoconfigure%" == "N" (
			goto execute_starters_ensure
		) else (
			if "%execute_autoconfigure%" == "n" (
				goto execute_starters_ensure
			) else (
				goto execute_autoconfigure
			)
		)
	:execute_autoconfigure
		echo[INFO] ************************************************************************
		echo[INFO] listening-boot-autoconfigure (v3.0.0-SNAPSHOT)
		echo[INFO] ************************************************************************
		cd %~dp0/listening-boot-autoconfigure
		echo %~dp0/listening-boot-autoconfigure
		call mvn %mvn_command%
		goto execute_starters_ensure
	
	:execute_starters_ensure
		echo= 
		echo= 
		set/p execute_starters=execute options on listening-boot-starters ?[Y/n]:
		if "%execute_starters%" == "N" (
			goto execute_widgets_ensure
		) else (
			if "%execute_starters%" == "n" (
				goto execute_widgets_ensure
			) else (
				goto execute_starters
			)
		)
	
	:execute_starters
		echo[INFO] ************************************************************************
		echo[INFO] listening-boot-starters (v3.0.0-SNAPSHOT)
		echo[INFO] ************************************************************************
		cd %~dp0/listening-boot-starters
		echo %~dp0/listening-boot-starters
		call mvn %mvn_command%
		goto execute_widgets_ensure
	
	:execute_widgets_ensure
		echo= 
		echo= 
		set/p execute_widgets=execute options on listening-boot-widgets ?[Y/n]:
		if "%execute_widgets%" == "N" (
			goto execute_webjars_ensure
		) else (
			if "%execute_widgets%" == "n" (
				goto execute_webjars_ensure
			) else (
				goto execute_widgets
			)
		)
	:execute_widgets
		echo[INFO] ************************************************************************
		echo[INFO] listening-boot-widgets (v3.0.0-SNAPSHOT)
		echo[INFO] ************************************************************************
		cd %~dp0/listening-boot-widgets
		echo %~dp0/listening-boot-widgets
		call mvn %mvn_command%
		goto execute_webjars_ensure
	
	:execute_webjars_ensure
		echo= 
		echo= 
		set/p execute_webjars=execute options on listening-boot-webjars ?[Y/n]:
		if "%execute_webjars%" == "N" (
			goto choose
		) else (
			if "%execute_webjars%" == "n" (
				goto choose
			) else (
				goto execute_webjars
			)
		)
	:execute_webjars
		echo[INFO] ************************************************************************
		echo[INFO] listening-boot-webjars (v3.0.0-SNAPSHOT)
		echo[INFO] ************************************************************************
		cd %~dp0/listening-boot-webjars
		echo %~dp0/listening-boot-webjars
		call mvn %mvn_command%

goto choose